package com.woniu.order.controller;

import com.woniu.common.utils.ResponseData;
import com.woniu.order.dto.LogisticsInforDTO;
import com.woniu.order.service.LogisticsCompanyService;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogisticsCompanyController {
    @Autowired
    private LogisticsCompanyService logisticsCompanyService;

    @PostMapping("/queryShipment")
    public ResponseData<?> queryShipment(@RequestBody String orderId) {
        String substring = orderId.substring(0, orderId.length() - 1);
        return logisticsCompanyService.queryShipment(substring);
    }

    /**
     * @param : []
     * @return java.lang.Boolean
     * @author zxyang3636
     * @date 2024/8/14
     * {@link Boolean}
     * @description 同步物流信息
     */
    @PostMapping("/synchronousLogisticsInfo")
    public Boolean synchronousLogisticsInfo(@RequestBody LogisticsInforDTO logisticsInforDTO) {
        return logisticsCompanyService.synchronousLogisticsInfo(logisticsInforDTO);
    }
}
